/*
*	Copyright (C) 2014  Julio Montes, Mario Carrillo
*	
*	Julio Montes e-mail: imc.coder@gmail.com 
*
*	Mario Carrillo e-mail: mario_90ago@live.com.mx
*
*	BSD 3-Clause License
*/

#ifndef IAEDITORMANAGER_H
#define IAEDITORMANAGER_H

#include <wx/wx.h>
#include <wx/aui/aui.h>
#include <wx/aui/auibook.h>

#include <wx/wxscintilla.h>

#include <wx/thread.h>


///ID's: 201-300
#define iaID_EDITOR_MANAGER 201

namespace sdk
{
    class Editor;
    class FileConfig;
}

class iaEditorManager : public wxAuiNotebook
{
public:
    iaEditorManager( wxWindow *parent );

    virtual ~iaEditorManager();

    int FindEditor( const wxString &fileName ) const;

    bool SaveEditorAs();

    bool SaveCurrentEditor();

    bool SaveAllEditors();

    bool SaveEditor( const wxString &fileName );

    bool SaveEditor( sdk::Editor *editor );

    bool CloseCurrentEditor();

    bool CloseAllEditors();

    bool CloseEditor( const wxString &fileName );

    bool CloseEditor( sdk::Editor *editor );

    sdk::Editor *GetCurrentEditor() const;

    sdk::Editor *GetEditor( const wxString &fileName ) const;

    void OpenFile( const wxString &fileName, const wxString &title=wxEmptyString, const wxBitmap &image=wxNullBitmap );

    void NewFile();

    int SetSelectionEditor( const wxString &fileName );
protected:
private:
    void OnPageClose( wxAuiNotebookEvent &event );

    void OnSavePointReached( wxScintillaEvent &evt );

    void OnSavePointLeft( wxScintillaEvent &evt );

    sdk::FileConfig *configEditor;

    DECLARE_EVENT_TABLE()
};

#endif // IAEDITORMANAGER_H
